/* GUI CONVERTED from rsporp.p (converter v1.76) Thu May 30 14:01:39 2002 */
/* rsporp.p - Release Management Supplier Schedules                       */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                    */
/* All rights reserved worldwide.  This is an unpublished work.           */
/* $Revision: 1.12 $                                                   */
/*V8:ConvertMode=FullGUIReport                                            */
/* REVISION: 7.3      LAST MODIFIED: 12/10/92           BY: WUG *G462*    */
/* REVISION: 7.3      LAST MODIFIED: 01/16/95           by: srk *G0C1*    */
/* REVISION: 8.6E     LAST MODIFIED: 02/23/98   BY: *L007* A. Rahane      */
/* REVISION: 8.6E     LAST MODIFIED: 05/20/98   BY: *K1Q4* Alfred Tan     */
/* REVISION: 8.6E     LAST MODIFIED: 09/02/98   BY: *L08H* A. Shobha      */
/* REVISION: 9.1      LAST MODIFIED: 03/24/00 BY: *N08T* Annasaheb Rahane */
/* REVISION: 9.1      LAST MODIFIED: 08/12/00 BY: *N0KP* myb              */
/* REVISION: 9.1      LAST MODIFIED: 09/11/00 BY: *N0RT* Mudit Mehta      */
/* Old ECO marker removed, but no ECO header exists *F0PN*                    */
/* $Revision: 1.12 $    BY: Dan Herman            DATE: 05/24/02  ECO: *P018*  */
/******************************************************************************/
/* All patch markers and commented out code have been removed from the source */
/* code below. For all future modifications to this file, any code which is   */
/* no longer required should be deleted and no in-line patch markers should   */
/* be added.  The ECO marker should only be included in the Revision History. */
/******************************************************************************/

/* SCHEDULED ORDER REPORT */


/*GUI global preprocessor directive settings */
&GLOBAL-DEFINE PP_PGM_RP TRUE
&GLOBAL-DEFINE PP_ENV_GUI TRUE


/*GUI preprocessor directive settings */
&SCOPED-DEFINE PP_GUI_CONVERT_MODE REPORT

{mfdtitle.i "2+ "}


define new shared variable supplier_from like po_vend.
define new shared variable supplier_to like po_vend.
define new shared variable shipto_from like po_ship.
define new shared variable shipto_to like po_ship.
define new shared variable part_from like pod_part.
define new shared variable part_to like pod_part.
define new shared variable po_from like po_nbr.
define new shared variable po_to like po_nbr.
define new shared variable buyer_from like po_buyer.
define new shared variable buyer_to like po_buyer.
define new shared variable sortoption as integer
   label "Sort Option" format "9" initial 1.

define new shared variable sortextoption as character extent 3
   format "x(51)".

{pocnvars.i} /* Consignment variables */

sortextoption[1] = "1 - " + getTermLabel("BY",4) + " " +
                     getTermLabel("SHIP-TO",12) + ", " +
                     getTermLabel("SUPPLIER",12) + ", " +
                     getTermLabel("ITEM",8) + ", " +
                     getTermLabel("PURCHASE_ORDER",4).
sortextoption[2] = "2 - " + getTermLabel("BY",4) + " " +
                     getTermLabel("ITEM",8) + ", " +
                     getTermLabel("SHIP-TO",12) + ", " +
                     getTermLabel("SUPPLIER",12) + ", " +
                     getTermLabel("PURCHASE_ORDER",4).
sortextoption[3] = "3 - " + getTermLabel("BY",4) + " " +
                     getTermLabel("PURCHASE_ORDER",4) + ", " +
                     getTermLabel("ITEM",8).


/*GUI preprocessor Frame A define */
&SCOPED-DEFINE PP_FRAME_NAME A

FORM /*GUI*/ 
   
 RECT-FRAME       AT ROW 1.4 COLUMN 1.25
 RECT-FRAME-LABEL AT ROW 1   COLUMN 3 NO-LABEL
 SKIP(.1)  /*GUI*/
po_from          colon 16
   po_to            colon 46 label {t001.i}
   part_from        colon 16
   part_to          colon 46 label {t001.i}
   supplier_from    colon 16
   supplier_to      colon 46 label {t001.i}
   shipto_from      colon 16
   shipto_to        colon 46 label {t001.i}
   buyer_from       colon 16
   buyer_to     colon 46 label {t001.i}
   skip(1)
   sortoption           colon 16
   sortextoption[1]     at 26 no-label
   sortextoption[2]     at 26 no-label
   sortextoption[3]     at 26 no-label
   skip(1)
 SKIP(.4)  /*GUI*/
with frame a side-labels width 80 attr-space NO-BOX THREE-D /*GUI*/.

 DEFINE VARIABLE F-a-title AS CHARACTER.
 F-a-title = &IF (DEFINED(SELECTION_CRITERIA) = 0)
  &THEN " Selection Criteria "
  &ELSE {&SELECTION_CRITERIA}
  &ENDIF .
 RECT-FRAME-LABEL:SCREEN-VALUE in frame a = F-a-title.
 RECT-FRAME-LABEL:WIDTH-PIXELS in frame a =
  FONT-TABLE:GET-TEXT-WIDTH-PIXELS(
  RECT-FRAME-LABEL:SCREEN-VALUE in frame a + " ", RECT-FRAME-LABEL:FONT).
 RECT-FRAME:HEIGHT-PIXELS in frame a =
  FRAME a:HEIGHT-PIXELS - RECT-FRAME:Y in frame a - 2.
 RECT-FRAME:WIDTH-CHARS IN FRAME a = FRAME a:WIDTH-CHARS - .5. /*GUI*/

/*GUI preprocessor Frame A undefine */
&UNDEFINE PP_FRAME_NAME



/* SET EXTERNAL LABELS */
setFrameLabels(frame a:handle).

{wbrp01.i}

/* DETERMINE IF SUPPLIER CONSIGNMENT IS ACTIVE */
{gprun.i ""gpmfc01.p""
   "(input ENABLE_SUPPLIER_CONSIGNMENT,
     input 11,
     input ADG,
     input SUPPLIER_CONSIGN_CTRL_TABLE,
     output using_supplier_consignment)"}


/*GUI*/ {mfguirpa.i true "printer" 80 " " " " " "  }

/*GUI repeat : */
/*GUI*/ procedure p-enable-ui:


   display sortextoption
   with frame a.

   if po_to = hi_char then po_to = "".
   if part_to = hi_char then part_to = "".
   if supplier_to = hi_char then supplier_to = "".
   if shipto_to = hi_char then shipto_to = "".
   if buyer_to = hi_char then buyer_to = "".
   if c-application-mode <> 'WEB' then
   
run p-action-fields (input "display").
run p-action-fields (input "enable").
end procedure. /* p-enable-ui, replacement of Data-Entry GUI*/

/*GUI*/ procedure p-report-quote:

   {wbrp06.i &command = update
      &fields = " po_from po_to part_from part_to supplier_from
        supplier_to shipto_from shipto_to buyer_from
        buyer_to sortoption "
      &frm = "a"}
   if c-application-mode <> 'WEB' or
      ( c-application-mode = 'WEB' and
      c-web-request begins 'DATA') then do:
      bcdparm = "".
      {mfquoter.i po_from     }
      {mfquoter.i po_to       }
      {mfquoter.i part_from   }
      {mfquoter.i part_to     }
      {mfquoter.i supplier_from}
      {mfquoter.i supplier_to }
      {mfquoter.i shipto_from }
      {mfquoter.i shipto_to   }
      {mfquoter.i buyer_from  }
      {mfquoter.i buyer_to    }
      {mfquoter.i sortoption  }

      if po_to = "" then po_to = hi_char.
      if part_to = "" then part_to = hi_char.
      if supplier_to = "" then supplier_to = hi_char.
      if shipto_to = "" then shipto_to = hi_char.
      if buyer_to = "" then buyer_to = hi_char.
   end.

   /* OUTPUT DESTINATION SELECTION */
   
/*GUI*/ end procedure. /* p-report-quote */
/*GUI - Field Trigger Section */

/*GUI MFSELxxx removed*/
/*GUI*/ procedure p-report:
/*GUI*/   {gpprtrpa.i "printer" 80 " " " " " " " " }
/*GUI*/   mainloop: do on error undo, return error on endkey undo, return error:



   {mfphead2.i}

   if sortoption = 1 then do:
      for each scx_ref no-lock
            where scx_type = 2
            and scx_shipfrom >= supplier_from and scx_shipfrom <= supplier_to
            and scx_shipto >= shipto_from and scx_shipto <= shipto_to
            and scx_part >= part_from and scx_part <= part_to
            and scx_po >= po_from and scx_po <= po_to,
            each pod_det no-lock
            where pod_nbr = scx_order and pod_line = scx_line,
            each po_mstr no-lock
            where po_nbr = pod_nbr
            and po_buyer >= buyer_from and po_buyer <= buyer_to
            break by scx_shipto by scx_shipfrom by scx_part by scx_po:

         {gprun.i ""rsporpa.p""
            "(input recid(scx_ref),
              input using_supplier_consignment)"}

         
/*GUI*/ {mfguichk.i } /*Replace mfrpchk*/

      end.
   end.
   else
      if sortoption = 2 then do:
      for each scx_ref no-lock
            where scx_type = 2
            and scx_shipfrom >= supplier_from and scx_shipfrom <= supplier_to
            and scx_shipto >= shipto_from and scx_shipto <= shipto_to
            and scx_part >= part_from and scx_part <= part_to
            and scx_po >= po_from and scx_po <= po_to,
            each pod_det no-lock
            where pod_nbr = scx_order and pod_line = scx_line,
            each po_mstr no-lock
            where po_nbr = pod_nbr
            and po_buyer >= buyer_from and po_buyer <= buyer_to
            break by scx_part by scx_shipto by scx_shipfrom by scx_po:

         {gprun.i ""rsporpa.p""
            "(input recid(scx_ref),
              input using_supplier_consignment)"}

         
/*GUI*/ {mfguichk.i } /*Replace mfrpchk*/

      end.
   end.
   else
      if sortoption = 3 then do:
      for each scx_ref no-lock
            where scx_type = 2
            and scx_shipfrom >= supplier_from and scx_shipfrom <= supplier_to
            and scx_shipto >= shipto_from and scx_shipto <= shipto_to
            and scx_part >= part_from and scx_part <= part_to
            and scx_po >= po_from and scx_po <= po_to,
            each pod_det no-lock
            where pod_nbr = scx_order and pod_line = scx_line,
            each po_mstr no-lock
            where po_nbr = pod_nbr
            and po_buyer >= buyer_from and po_buyer <= buyer_to
            break by scx_po by scx_part:

         {gprun.i ""rsporpa.p""
            "(input recid(scx_ref),
              input using_supplier_consignment)"}

         
/*GUI*/ {mfguichk.i } /*Replace mfrpchk*/

      end.
   end.

   /* REPORT TRAILER */
   
/*GUI*/ {mfguitrl.i} /*Replace mfrtrail*/

/*GUI*/ {mfgrptrm.i} /*Report-to-Window*/

end.
{wbrp04.i &frame-spec=a}

/*GUI*/ end procedure. /*p-report*/
/*GUI*/ {mfguirpb.i &flds=" po_from po_to part_from part_to supplier_from supplier_to shipto_from shipto_to buyer_from buyer_to sortoption "} /*Drive the Report*/
